System and method for controlling video coding within image frame

ABSTRACT

A method for controlling video coding includes: obtaining an image frame from a video stream, wherein the image frame is associated with a coding control model; encoding the image frame using a quantization parameter (QP) calculated based on the coding control mode; determining whether a scene has changed significantly based on an analysis of the encoded image frame; in response to the scene having changed significantly, initializing parameters for the coding control model; and in response to no significant scene change, updating the parameters for the coding control model.

CROSS-REFERENCE TO RELATED APPLICATIONS

This application is a continuation of U.S. patent application Ser. No.15/930,135, filed on May 12, 2020, which is a continuation ofInternational Application No. PCT/CN2017/113848, filed Nov. 30, 2017,the entire contents of both of which are incorporated herein byreference.

COPYRIGHT NOTICE

A portion of the disclosure of this patent document contains materialwhich is subject to copyright protection. The copyright owner has noobjection to the facsimile reproduction by anyone of the patent documentor the patent disclosure, as it appears in the Patent and TrademarkOffice patent file or records, but otherwise reserves all copyrightrights whatsoever.

TECHNICAL FIELD

The disclosed embodiments relate generally to video processing, moreparticularly, but not exclusively, to video coding.

BACKGROUND

The consumption of video content has been surging in recent years,mainly due to the prevalence of various types of portable, handheld, orwearable devices. Typically, the video data or other media content isencoded at the source into an encoded (compressed) bit stream, which isthen transmitted to a receiver over a communication channel. It isimportant, however, to control the bit rate of encoded bit streams inorder to ensure that various constraints of the sender, the receiver,and/or the communication channel are met. For instance, it may bedesirable to keep the bit rate of the encoded video frames below acertain maximum bit rate so as to prevent buffer overflow or toaccommodate a bandwidth limitation. This is the general area thatembodiments of the disclosure are intended to address.

SUMMARY

Described herein are systems and methods that can control video coding.A video encoder can obtain a target rate to encode an image data unitsuch as an image frame, wherein the image data unit is to be encodedbased on a rate control model with one or more model parameters. Thevideo encoder can determine values of the one or more model parametersfor the rate control model based on an encoding of one or more referenceimage data units using one or more reference coding parameters. Then,the video encoder can determine values of one or more coding parametersfor encoding the image data unit, based on the rate control model withthe one or more determined model parameters, and use the one or moredetermined coding parameters to encode the image data unit.

Also described herein are systems and methods that can control videocoding. A video encoder can obtain an image frame, wherein the imageframe comprises a plurality of coding block groups, wherein each codingblock group includes one or more coding blocks and each coding blockgroup is associated with a coding control model. Furthermore, the videoencoder can determine values of one or more coding parameters, for afirst coding control model associated with a first coding block group,based on a bit allocation for the first coding block group, and use thefirst coding control model with the one or more determined codingparameters to encode the first coding block group.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 illustrates an exemplary system for implementing coding ratecontrol, in accordance with various embodiments of the presentdisclosure.

FIG. 2 illustrates encoding/compressing a video, in accordance withvarious embodiments of the present disclosure.

FIG. 3 illustrates a series of exemplary data levels, in accordance withvarious embodiments of the present disclosure.

FIG. 4 illustrates exemplary data units to be encoded, in accordancewith various embodiments of the present disclosure.

FIG. 5 illustrates exemplary hierarchical data units to be encoded, inaccordance with various embodiments of the present disclosure.

FIG. 6 illustrates exemplary rate control model at frame level, inaccordance with various embodiments of the present disclosure.

FIG. 7 shows an exemplary illustration of using a sliding window forpreventing coding fluctuation, in accordance with various embodiments ofthe present disclosure.

FIG. 8 illustrates a flow chat for controlling video encoding at framelevel, in accordance with various embodiments of the present disclosure.

FIG. 9 illustrates an exemplary encoder with rate control, in accordancewith various embodiments of the present disclosure.

FIG. 10 illustrates rate control for different control groups at basicunit level, in accordance with various embodiments of the presentdisclosure.

FIG. 11 illustrates an exemplary rate control scheme at basic unitlevel, in accordance with various embodiments of the present disclosure.

FIG. 12 illustrates an exemplary hardware implementation of the ratecontrol scheme, in accordance with various embodiments of the presentdisclosure.

FIG. 13 illustrates a flow chat for controlling video encoding withinimage frame, in accordance with various embodiments of the presentdisclosure.

DETAILED DESCRIPTION

The disclosure is illustrated, by way of example and not by way oflimitation, in the figures of the accompanying drawings in which likereferences indicate similar elements. It should be noted that referencesto “an” or “one” or “some” embodiment(s) in this disclosure are notnecessarily to the same embodiment, and such references mean at leastone.

The description of the disclosure as following uses the H.264 standardand the High Efficiency Video Coding (HEVC) standard as examples forcoding methods. It will be apparent to those skilled in the art thatother types of coding methods can be used without limitation.

In accordance with various embodiments of the present disclosure, thesystem can control video coding for achieving coding efficiency at framelevel. A video encoder can obtain a target rate to encode an image dataunit such as an image frame, wherein the image data unit is to beencoded based on a rate control model with one or more model parameters.The video encoder can determine value of the one or more modelparameters for the rate control model based on an encoding of one ormore reference image data units using one or more reference codingparameters. Then, the video encoder can determine value of one or morecoding parameters for encoding the image data unit, based on the ratecontrol model with the one or more determined model parameters, and usethe one or more determined coding parameters to encode the image dataunit.

In accordance with various embodiments of the present disclosure, thesystem can control video coding within image frame, such as at basicunit level, for achieving coding efficiency. A video encoder can obtainan image frame, wherein the image frame comprises a plurality of codingblock groups, such as basic units, wherein each coding block groupincludes one or more coding blocks and each coding block group isassociated with a coding control model. Furthermore, the video encodercan determine values of one or more coding parameters, for a firstcoding control model associated with a first coding block group, basedon a bit allocation for the first coding block group, and use the firstcoding control model with the one or more determined coding parametersto encode the first coding block group.

FIG. 1 illustrates an exemplary system 100 for implementing coding ratecontrol, in accordance with various embodiments of the presentdisclosure. As shown in FIG. 1, an encoder 101 can be configured toreceive and encode input data 102 to produce output data 104. Forinstance, the encoder 101 may be configured to receive videos as inputdata 102, and encode the input video data to produce one or morecompressed bit streams as output data 104.

During data encoding, the encoder 101 may be configured to control thebit size of the encoded data (and hence the bit rate), e.g. via a ratecontroller 103. The encoder 101 and the rate controller 103 may beimplemented by the same or different computing devices. In someembodiments, the rate controller 103 may form an integral part of theencoder 101; or vice versa. The encoder 101 is configured to receiveinput data 102, encode the input data 102, and provide output data 104comprising the encoded data. The input data 102 can include text,images, graphic objects, animation sequences, audio recordings, videos,or any other data that needs to be encoded. In some cases, the inputdata 102 may include sensing data from one or more sensors such asvision sensors (e.g., cameras, infrared sensors), microphones, proximitysensors (e.g., ultrasound, lidar), position sensors, temperaturesensors, touch sensors, and the like.

Encoding of the input data 102 can involve data compression, encryption,error encoding, format conversion, and the like. For example, multimediadata such as video or audio may be compressed to reduce the number ofbits that are transmitted over the network. Sensitive data such asfinancial information and personal identification information may beencrypted before being transmitted or stored to protect confidentialityand/or privacy. Thus, the encoding of the input data 102 can bebeneficial for efficient and/or secure transmission or storage of thedata.

In accordance with various embodiments of the present disclosure, anencoder 101 may be configured to encode a series of video or imageframes. In some embodiments, the encoder 101 may implement one or moredifferent codecs. Each of the one or more codecs may take advantage ofvarious codes, instructions or computer programs that implementdifferent encoding algorithms. A suitable codec may be selected toencode a given set of input data based on various factors, including thetypes and/or sources of input data, the receiving entities of theencoded data, availability of computing resources, network environment,business requirements, regulations and standards, and the like.

FIG. 2 illustrates encoding/compressing a video, in accordance withvarious embodiments of the present disclosure. As shown in FIG. 2, datain each frame may be encoded using a series of steps, such as aprediction step 201, a transformation step 202, a quantization step 203and an entropy encoding step 204.

In accordance with various embodiments, the prediction step 201 can beemployed for reducing redundant information in the image frame. Theprediction step 201 can include intra-frame prediction and inter-frameprediction. The intra-frame prediction may be performed based solely oninformation that is contained within the current frame, independent ofother frames in the video sequence. For example, the encoding processcan be used to encode intra frames (I frames) based primary or entirelyon spatial information contained within the intra frame (or I frame).Inter-frame prediction can be performed by eliminating redundancy in thecurrent frame based on a reference frame, e.g. a previously processedframe. For example, the encoder 103 may be configured to exploittemporal redundancy between the frames and encode inter frames (e.g., Pframes or B frames) based on forward and/or backward predictions madefrom previous and/or subsequent frames.

In accordance with various embodiments, a frame may be forward and/orbackward predicted for inter-frame prediction based on a previous frameand/or a subsequent frame by estimating motion of the camera and/orobjects in the video. For example, in order to perform motion estimationfor inter-frame prediction, a frame can be divided into a plurality ofimage blocks. Each image block can be matched to a block in thereference frame, e.g. based on a block matching algorithm. In someembodiments, a motion vector (MV), which represents an offset from thecoordinates of an image block in the current frame to the coordinates ofthe matched image block in the reference frame, can be computed. Also,the residuals, i.e. the difference between each image block in thecurrent frame and the matched block in the reference frame, can becomputed and grouped. The system can process the residuals for improvingcoding efficiency. For example, transformation coefficients can begenerated by applying a transformation matrix (and its transposedmatrix) on the grouped residuals.

Any suitable motion estimation techniques may be used to determine themotion vectors between adjacent frames, including pixel based methods(e.g., block-matching) and feather based methods (e.g., cornerdetection). If an acceptable match of a corresponding data unit (e.g.,macroblock) is not found, then the encoder may encode the data unit asan intra data unit. In various embodiments, the predicted frame may besubtracted from its reference to generate the residual (error) frame.The data included in the residual (error) frame may be spatially encodedin a similar fashion as for an intra-frame. For example, one or moredata matrices of the residual error frame may be transformed (e.g.,using DCT) and quantized. The quantized transform coefficients of theresidual error frame, the motion vectors or the difference betweenmotion vectors of adjacent frames, along with any other suitable dataneeded to reconstruct the frame may be entropy encoded. The bit rate ofthe encoded data may be controlled at least in part by a quantizationparameter provided by a rate controller.

During the transformation step 202, the input data and/or the residualsmay be transformed into a different domain (e.g., spatial frequencydomain) suitable for the data content of the input data (e.g., video).Any suitable coding transformation techniques may be used, includingFourier-type transforms such as discrete cosine transform (DCT) ormodified DCT. For example, a DCT matrix is determined based on a size ofthe data unit. The data unit may include a block of 4×4 or 8×8 pixels, amacroblock of 16×16 pixels, or any suitable set of data. The DCT matrixis then applied to the data unit using matrix multiplication, yielding atransformed matrix comprising transformation coefficients.

Subsequently, the transformation coefficients can be quantized at aquantization step 203 and can be encoded at an entropy encoding step204. At the quantization step 203, the coefficients in the transformedmatrix may be quantized, for example, by dividing each coefficient by acorresponding element in a quantization matrix, and then rounding to thenearest integer value. The quantization matrix may be derived using aquantization parameter (also referred to as a quantization index). Forexample, the quantization parameter may be the value for each element ofthe quantization matrix. In another example, some or all of the elementsin the quantization matrix may be scaled (multiplied or divided) by thequantization parameter and the scaled quantization matrix may be used toquantize the transformed matrix. The quantization parameter may be aninteger within a certain range (e.g., between and including 0 and 128).Typically, the higher the value of the quantization parameter, thelarger the quantization step size is and the larger the element valuesare in the quantization matrix. This may cause more transformationcoefficients to be quantized to zero or near-zero. The more zero ornear-zero coefficients there are, the less bits are required to encodethe coefficients, resulting in lower bit size (and hence lower bit rate)for the data unit represented by the coefficients. The opposite is alsotrue, that is, a lower value of a quantization parameter corresponds toa smaller quantization step size, a greater number of bits required toencode the quantized coefficients, and a higher bit size (and hencehigher bit rate) for the data unit encoded using the quantizationparameter. Techniques are provided herein for controlling the bit rateof the encoded input data by varying the quantization parameters used toencode portions of the input data.

At the entropy encoding step 204, the quantized coefficients in aquantized matrix can be scanned in a predetermined order and encodedusing any suitable coding technique. For example, since most of thenon-zero DCT coefficients are likely concentrated in the upper left-handcorner of the matrix, a zigzag scanning pattern from the upper left tothe lower right is typical. Alternative scanning order such as a rasterscan may be used. The scanning order may be used to maximize theprobability of achieving long runs of consecutive zero coefficients. Thescanned coefficients can then be encoded using run-length encoding,variable-length encoding, or any other entropy encoding techniques, togenerate the output data 104.

Then, the bit stream including information generated from the entropyencoding step 104, as well as other encoding information (e.g.,intra-frame prediction mode, motion vector) can be stored and/ortransmitted to a decoder (not shown) at the receiving end. The decodermay be configured to perform decoding steps that are the inverse of theencoding steps of the encoder in order to generate reconstructed data.The decoder can perform a reverse process (such as entropy decoding,dequantization and inverse transformation) on the received bit stream toobtain the residuals. Thus, the image frame can be decoded based on theresiduals and other received decoding information. In variousembodiments, the reconstructed data (i.e. the decoded image) may then bedisplayed or played back. For example, to decode intra encoded data(e.g., I frames), the decoding steps may include an entropy decodingstep (e.g., using variable length decoding), an inverse quantizationstep, and an inverse transform step (e.g., using Inverse Discrete CosineTransform (IDCT)) that perform the inverse of the corresponding entropyencoding, quantization, and transform steps of the encoder. To decodeinter encoded data (e.g., B frames or P frames), the decoding processcan include additional motion compensation support.

Referring to FIG. 1, the rate controller 103 may be configured tocontrol the bit rate of the output data by providing the encoder 101with one or more coding parameters (also referred to as rate controlparameters). The bit rate may be controlled to be within a certain range(e.g., below a maximum bit rate, above a minimum bit rate) or close to atarget average bit rate. Alternatively, the bit rate may be controlledto vary depending on the complexity of the frames, bandwidth limit,buffer capacity, and other factors. The coding parameters can includeone or more quantization parameters (QPs) for controlling thequantization step of the encoding process and hence the bit rate of theresulting output data. The quantization parameters may include, forexample, a quantization step size, a value indicative of or related to aquantization step size such as a QP used in H.264 or similar encoders, aquantization matrix or a reference thereof, and the like. The codingparameters may include parameters for controlling other aspects of theencoding process such as the prediction step, the transform step, and/orthe entropy encoding step. For instance, coding parameters may include acutoff index used for removing certain high frequency coefficientsbefore the coefficients are entropy encoded. Other examples of thecoding parameters may include bit allocation information (e.g., maximum,minimum, or target bits allocated for encoding a data unit), a framerate, a size of a data unit to be transformed and quantized, motiondetection thresholds used to determine whether to code or skip coding adata unit (e.g., macroblock), Lagrange multiplier used in ratedistortion optimization, algorithms and parameters used for theprediction, transform, and/or entropy encoding steps, and the like.

The rate controller 103 may be configured to control rate (e.g., byproviding the code parameters) based at least in part on outputinformation about the output data 104 and/or the encoder 101. The outputinformation may be provided by the encoder 101 or optionally derived bythe rate controller 103 based on the output data 104. The outputinformation may include, for example, a number of bits used to encode adata unit (e.g., a frame, a slice, a macroblock), parameters (includingalgorithms) used to encode the data unit, encoder resource information(e.g., CPU/memory usage, buffer usage), and the like. Such informationmay be used by the rate controller 103 to adjust one or more codingparameters (e.g., a quantization parameter) for one or more subsequentdata units.

The rate controller 103 may optionally be configured to control ratebased at least in part on input information about the input data 102.Input information may include any characteristics of the input data thatmay be used for rate control, such as resolution, size, imagecomplexity, texture, luminance, chrominance, motion information, and thelike. For example, highly complex input data may be encoded with ahigher bit rate than less complex input data.

In some embodiments, the rate controller 103 may be configured tocontrol rate based on one or more rate control threshold parameters. Thevalues of the threshold parameters may be predefined and/or dynamicallyupdated by a user, a system administrator, the rate controller 103, orany other component or device. The rate control threshold parameters maybe used to derive coding parameters. In some embodiments, the thresholdvalues used to determine the coding parameters for encoding a givenslice may vary depending on an encoding order of the slice relative toother slices of a frame.

In some embodiments, the rate controller 103 may be configured tocontrol rate based on additional information. Such information mayinclude decoder information from an entity configured to receive,decode, and/or playback or display the output data 108. For example,such information may be related to the decoder buffer usage, delay,noise, and/or playback quality. Additionally, such information may berelated to the current computing environment (e.g., network bandwidth,workload), user instructions, or any other suitable information relevantto rate control.

In accordance with various embodiments, the output data 104 may bestored at a local or remote data store and/or provided to a local orremote decoder. The output data 104 may be transmitted over acommunication channel. Exemplary communication channels include wired orwireless networks such as the Internet, storage area network (SAN),local area networks (LAN), wide area networks (WAN), point-to-point(P2P) networks, Wi-Fi network, radio communication, and the like.

The following discussion focus on the encoding of input data comprisingsingle value pixel data. However, it is understood that the techniquesdiscussed herein can be extended to input data where each pixel isrepresented by multiple data values corresponding to multiplecomponents, such as color space channels. For instance, a block of imagedata may be represented by multiple blocks of the same size or differentsize, each block comprising pixel data related to a particular componentor channel of a color space associated with the image data. In oneexample, an 8×8 block of YCbCr encoded image data may be represented byan 8×8 block of Y (luma) data and two blocks of chrominance datacorresponding to Cb and Cr channels respectively (e.g. the sizes ofwhich corresponds to different sample rates). The encoding stepsdiscussed herein can be applied to each of the luma and chrominance datablocks in order to encode the entire input data.

In accordance with various embodiments of the present disclosure, videoencoding and rate control can be implemented at any suitable data levelor levels. FIG. 3 illustrates a series of exemplary data levels 300,which may include group of pictures (GOP) level 301, frame level 302,and basic unit level 303. In various embodiments, a group of pictures(GOP) may refer to a collection of successive (or non-successive)pictures within a coded video stream. For example, a GOP may comprise astream of image frames including both intra and inter prediction frames.Alternatively, a GOP may comprise a plurality of inter prediction framesonly.

In various embodiments, video coding techniques may be applied ondifferent basic units. The basic unit level may be defined differentlyfor different coding standards or applications. For example, in H.264,the basic unit level may be slice level, macroblock level, block level,pixel level, and/or the like. Alternatively, in HEVC, the basic unitlevel may be coding tree unit (CTU) level, coding unit (CU) level,and/or the like.

FIG. 4 illustrates exemplary data units to be encoded, in accordancewith various embodiments of the present disclosure. As illustrated, inH.264, a data unit may refer to a frame, a slice, a macroblock, ablocks, a pixel, or a group of any of the above. For example, in anexemplary system 400 supporting H.264, an input data 402 can comprise aplurality of image frames, such as consecutive image frames in a videostream. A frame 404 may comprise one or more slices 406, and each slicemay comprise one or more macroblocks 408. Furthermore, a macroblock 408may comprise one or more blocks 410, each of which may comprise one ormore pixels. For example, a pixel 412 may comprise one or more sets ofdata corresponding to one or more data components such as luminance datacomponent and chrominance data component.

FIG. 5 illustrates exemplary hierarchical data units to be encoded, inaccordance with various embodiments of the present disclosure. Asillustrated, an input data 502 can comprise a plurality of frames 504,which may represent consecutive image frames in a video stream. Forexample, in an exemplary system 500 supporting HEVC, each frame 504 maycomprise one or more coding tree units (CTUs) or largest coding units(LCUs) 506, which may be represented using a quadtree 508 in ahierarchical fashion. As illustrated, each LCU 506 may comprise one ormore coding units (CU)s. Each CU may comprise one or more blocks. Eachblock may comprise one or more pixels. Each pixel may comprise one ormore sets of data corresponding to one or more data components such asluminance data component and chrominance data component.

In various embodiments, the encoding steps discussed herein can beapplied to any suitable data level or levels. Applying an encoding stepat a certain data level may indicate that an entire (or a portion of a)data unit at the given data level may be encoded before the encodingstep is applied to the next data unit. The encoding steps may be appliedat the same data level. For instance, using the H.264 standard, thetransformation step and/or quantization step can be applied at a blocklevel (e.g., to 8×8 pixel blocks), a macroblock level (e.g., to 16×16pixel macroblocks), or at a slice level. Alternatively, differentencoding steps may be performed at different data levels. For instance,the transformation step may be performed at the macroblock level, thequantization step may be performed at the slice level, and the entropyencoding step may be performed at the frame level. In one example, allthe macroblocks within a given slice may be transformed one by onebefore the entire transformed slice is quantized, and all the sliceswithin a frame may be quantized before the quantized coefficients areentropy encoded.

Similarly, the rate control parameters may be applicable to any suitabledata level or levels. For example, a single quantization parameter maybe used for the quantization of a block, a macroblock, or a slice. Insome embodiments, different rate control parameters may be associatedwith different encoding operations, which may be applied to differentdata levels. For example, a motion detection threshold may be used formotion detection of macroblocks, a quantization parameter may be usedfor quantization of slices, and another rate control parameter may beused during entropy encoding of an entire frame.

In accordance with various embodiments of the present disclosure,various rate control methods can improve coding efficiency byincorporating a rate distortion optimization (RDO) process fordetermining optimized coding parameters and bit allocation. In oneexample using the H.264 standard, a rate model may be used to predictthe number of bits output after a macroblock or frame is coded with aspecific QP; and a distortion model may be used to predict thedistortion associated with each QP. Combined, the rate model and thedistortion model can be used to determine an optimal value for thequantization parameter (QP) for each macroblock or frame, e.g. based ona measure of the variance of the residual signal (i.e. the predictiondifference signal) and a specific target bit allocation. For example,the best QP may be chosen using the Lagrangian optimization techniques.

Different rate control models may be employed for controlling the codingrate without limitation. In one example, the rate-distortionoptimization (RDO) process may use a rate-quantization (R-QP) model,e.g. based on the following quadratic rate-distortion (R-D) model.

R=a/QP+b/QP²

Potential interdependence may exist between the RDO process and the QPdetermination process for rate control. On one hand, the residualinformation may be used to determine an appropriate QP in order toachieve certain coding bit rate. On the other hand, the residualinformation may only be determined after the RDO process is completed,which requires a predetermined QP.

One solution to avoid such a “chicken or the egg” dilemma is using alinear model to predict the complexity of the data unit (e.g. frame,slice, macroblock in H.264 standard) to be encoded based on the residualsignal of previously encoded (and co-located) units, which allows the QPto be selected prior to the coding (e.g. prior to the coding modedecision). For example, the residual (e.g. the texture or predictionerror) can be measured using sum absolute distortion (SAD) or meanabsolute distortion (MAD), which assumes that the complexity variesgradually from picture to picture. However, for a non-stationary video(e.g. when a scene change occurs), the video quality may degradesharply, since information collected from previous frames is no longeruseful or relevant and the linear model may fail to predict a correctMAD. Furthermore, inaccurate MAD may cause the QP miscalculation (andframe window size miscalculation), which may result in poor RDOperformance.

In another example, the rate-distortion optimization (RDO) process mayemploy an R-λ model. Using the R-λ, model, the determination of aLagrangian multiplier, λ, is independent from the RDO process, whichhelps to solve the “chicken or the egg” dilemma as described in theabove. However, because λ is a continuous variable, and QP is a discretevariable, there is no straight forward one-to-one correspondencerelationship. This may cause the bit rate to fluctuate rather thanconverge when λ is iterated at the boundary (or gap) of the QP values,as the coding progresses. As a solution, a complex algorithm may be usedfor dealing with the bit rate fluctuation in coding. This may contributeto extra overhead and may become infeasible in various hardwareimplementations.

In accordance with various embodiments of the present disclosure, alogarithm R-QP model can be used for rate control to avoid codingfluctuation. For example, the following logarithm R-QP model can beemployed.

ln(bpp)=α˜QP+β

In the above logarithm model, α and β are parameters related to thevideo content. Also, the rate R can be represented using the bits perpixel (bpp), which may be calculated using the following formula,

${bpp} = \frac{R}{f \cdot w \cdot h}$

where f represents the frequency of the video frame series, and w and hrepresents the width and height of the video frame. In variousembodiments, the use of bits per pixel (bpp) allows the rate controlmodel to account for flexible unit and/or variable block size (e.g. forcoding units in the HEVC standard).

FIG. 6 illustrates exemplary rate control scheme at frame level, inaccordance with various embodiments of the present disclosure. Asillustrated in FIG. 6, at the step 601, the encoder 600 can obtain animage frame from a video stream. The obtained image frame may be anintra frame or an inter frame. Different approaches may be used forcoding the different types of image frames. For example, in H.264, thebit rate control model for each image frame can be updated iterativelyon a frame-by-frame basis. Due to the difference in the number of bitscoded for different types of frames (such as I frames and P frames), theencoder 600 may only apply rate control and update model for the sametype of coding frames. For example, for the Low-Delay P frame structure(IPPPPPP . . . ) or the Period-I frame structure (IPPP IPPP . . . ), themodel update may be performed for the P frames only. On the other hand,the rate control models for the I-frames may not be updated, even thoughthe rate control model may be used to predict QP for the I-frames.

Furthermore, the encoder 600 can initialize various model parameters ifneeded. For instance, at the step 602, the encoder 600 can determinewhether the obtained image frame is the first image frame in the videoseries. If the obtained image frame is the first image frame in thevideo series, then the encoder 600 can initialize the model parametersat the step 603. For the above logarithm model, the parameters, α and β,can be initialized with initial values α₀ and β₀. Otherwise, the encoder600 can take advantage of an existing rate control model that may be (ornot be) updated following the coding of a previous image frame.

As illustrated in FIG. 6, at the step 604, the encoder 600 can obtaintarget bit rate (R) at frame level for the obtained image frame.Optionally, the encoder 600 can calculate the bits per pixel (bpp) forthe obtained image frame based on the target bit rate. At the step 605,the encoder 600 can calculate the quantization parameter (QP) based onthe rate control model. For example, the encoder 600 can predict the QPusing the above logarithm model. Alternatively, the encoder 600 canpredict the QP using other approaches, e.g. using the above quadraticmodel. Then, at the step 606, the encoder 600 can encode the image frameusing the calculated QP.

Furthermore, the system can analyze the coding information and/orstatistics for the coded data after the encoder 600 finishes coding theimage frame. As illustrated in FIG. 6, at the step 607, the system candetermine whether the scene has changed significantly based on analyzingthe coded data. For example, the system can determine that the scene haschanged significantly when an intra-predicting block ratio is above athreshold. The intra-predicting block ratio may be defined as a ratio(or percentage) based on the number of intra-predicting blocks inencoding an image frame. When the scene has changed significantly, it islikely that the encoding of a substantial number of image blocks may beperformed based solely on information that is contained within thecurrent image frame, since the information contained in the previousimage frames may be drastically different when the scene changessignificantly.

At the step 608, the system can initialize model parameters if there isa scene change. On the other hand, at the step 609, the system canupdate the rate control model parameter accordingly, when there is nosignificant scene change. Furthermore, at the step 610, the system cancheck whether the video is completed. If not, the system can obtainanother image frame from the video for coding.

In accordance with various embodiments of the present disclosure,various techniques can be used for updating the rate control modelparameter while preventing fluctuation in video coding, which may occureven when the scene has not change drastically. For example, the systemcan update the rate control model parameters, α and β, using thefollowing formulas.

α_(new)=α_(old)+Δα

β_(new)=β_(old)+Δβ

In various embodiments, the system can dynamically control the update ofthe rate control model parameters, α and β, by taking advantage of alearning rate, μ. For example, using the logarithm model, modelparameters, α and β, may be updated using the following formulas as thecoding progresses, based on a random gradient decent algorithm.

α_(new)=α_(old)+μ·QP·(ln(bpp)−(α_(old)·QP+β_(flow)))

β_(new)=β_(old)+μ·(ln(bpp)−(α_(old)·QP+β_(flow)))

In various embodiments, the learning rate, μ, may be pre-configured orpre-determined. Alternatively, the learning rate, μ, may be determineddynamically as the coding progresses. For example the learning rate, μ,may be determined as

$\frac{1}{{QP^{2}} + 1},$

which corresponds to an optimized rate control model.

Alternatively, a sliding window can be used for preventing the codingfluctuation. In various embodiments, a sliding window can smooth out thefluctuation in coding/compressing based on the historic codinginformation.

FIG. 7 shows an exemplary illustration 700 of using a sliding window forpreventing coding fluctuation, in accordance with various embodiments ofthe present disclosure. As illustrated, a sliding window 701, which maybe used for determining the optimized model parameters, can comprise aplurality of image frames. Each of the image frame in the sliding window701 may correspond to one or more sample points 711-718. As the codingprogresses, a sliding window 702 may be used instead of the slidingwindow 701 for updating the model parameters. The sliding window 702 maycomprise one or more new image frames, which corresponds to one or morenew sample points (e.g. the sample point 719), while one or more oldimage frames, which corresponds to one or more old sample points (e.g.the sample point 711), may be removed from the sliding window 702.

For example, using the above logarithm R-QP model, each image frame i inthe sliding window 701 may correspond to a sample point ((QP_(i),ln(bpp_(i))), i∈[1, w]), assuming that the window size is w. As thecoding progresses, a different sliding window 702 may be used. Eachimage frame i in the sliding window 702 may correspond to a sample point((QP_(i), ln(bpp_(i))), i∈[2, w+1]).

Assuming that the resultant number of sample points is N, the system candetermine the model parameters, α and β, by minimizing the followingcost function.

J(α,β)=½Σ_(i=1) ^(N)(ln(bPP_(i))−(α·QP_(i)+β))²

In various embodiments, an optimized solution can be found based onvarious techniques. For example, by letting

${\frac{\partial{J( {\alpha,\beta} )}}{\partial\alpha} = 0},{\frac{\partial{J( {\alpha,\beta} )}}{\partial\beta} = 0},$

the least squares solution can be obtained as shown in the following.

${\begin{bmatrix}{\sum\limits_{i = 1}^{N}{QP_{i}^{2}}} & {\sum\limits_{i = 1}^{N}{QP}_{i}} \\{\sum\limits_{i = 1}^{N}{QP}_{i}} & N\end{bmatrix}\begin{bmatrix}\alpha \\\beta\end{bmatrix}} = \begin{bmatrix}{\sum\limits_{i = 1}^{N}{{QP}_{i} \cdot {\ln( {bpp}_{i} )}}} \\{\sum\limits_{i = 1}^{N}{\ln( {bpp}_{i} )}}\end{bmatrix}$

Thus, when N·Σ_(i=1) ^(N)QP_(i) ²−(Σ_(i=1) ^(N)QP_(i))²≠0, the modelparameters, α and β, may be updated using the following formulas as thecoding progresses.

$\mspace{79mu}{\alpha = \frac{{N \cdot {\sum_{i = 1}^{N}{Q{P_{i} \cdot {\ln( {bpp}_{i} )}}}}} - {\sum_{i = 1}^{N}{{\ln( {bpp}_{i} )} \cdot {\sum_{i = 1}^{N}{QP_{i}}}}}}{{N \cdot {\sum_{i = 1}^{N}{QP_{i}^{2}}}} - ( {\sum_{i = 1}^{N}{QP_{i}}} )^{2}}}$$\beta = \frac{{\sum_{i = 1}^{N}{{\ln( {bpp}_{i} )} \cdot {\sum_{i = 1}^{N}{QP_{i}^{2}}}}} - {\sum_{i = 1}^{N}{{QP}_{i} \cdot {\ln( {bpp}_{i} )} \cdot {\sum_{i = 1}^{N}{QP_{i}}}}}}{{N \cdot {\sum_{i = 1}^{N}{QP_{i}^{2}}}} - ( {\sum_{i = 1}^{N}{QP_{i}}} )^{2}}$

The above condition holds true when there are more than two distinctsample points existing in the sliding window, (i.e. N>2). In variousembodiments, the sample points in a sliding window can be pre-processed,so that each sample point in the sliding window may be associated with adistinctive QP. For example, the system can calculate an average ofdifferent values of ln(bpp_(k) ) for each distinctive QP_(k). Thus,multiple sample points associated with a same QP but with differentvalues of ln(bpp_(k) ) can be combined into one sample point (i.e., notwo sample points having different bits per pixel (bpp) values may beassociated with the same QP).

On the other hand, in the cases when there are no more than two distinctsample points existing in the sliding window (i.e. N<=2), the modelparameters, α and β, may be updated based on the random gradient decentalgorithm as the coding progresses.

FIG. 8 illustrates a flow chat for controlling video encoding at framelevel, in accordance with various embodiments of the present disclosure.As shown in FIG. 8, at step 801, a video encoder can obtain a targetrate to encode an image data unit such as an image frame, wherein theimage data unit is to be encoded based on a rate control model with oneor more model parameters. At step 802, the video encoder can determinevalues of the one or more model parameters for the rate control modelbased on an outcome of encoding one or more reference image data unitsusing one or more reference coding parameters. Then, at step 803, thevideo encoder can determine values of one or more coding parameters forencoding the image data unit, based on the rate control model with theone or more determined model parameters. At step 804, the video encodercan use the one or more determined coding parameters to encode the imagedata unit.

In accordance with various embodiments of the present disclosure,various rate control techniques may be performed within image frame atthe basic unit level to improve the precision of rate control, e.g. forachieving constant bit rate (CBR) control.

FIG. 9 illustrates an exemplary encoder with rate control, in accordancewith various embodiments of the present disclosure. As illustrated inFIG. 9, an encoder 900 can encode input data, such as an image input 901that can be split into multiple image blocks for coding. The encodingcan be based on intra-frame prediction 902 and inter-frame prediction904. The intra-frame prediction 902 may be performed based solely oninformation that is contained within the current frame, independent ofother frames in the video sequence. Inter-frame prediction 904 can beperformed by eliminating redundancy in the current frame based on areference frame, e.g. a previously processed frame. For example, theinter-frame prediction 904 can be based on motion estimation 903. Theinter-frame prediction 904 can involve choosing motion data comprisingthe selected reference picture and motion vector (MV) to be applied forpredicting the samples of each image blocks.

There may be different available modes for coding an image block. Forexample, in H.264, the available coding modes for a macroblock in anI-slice include: intra 4×4 prediction and intra 16×16 prediction forluma samples, and intra 8×8 for chroma samples. In HEVC, the number ofcoding modes are substantially increased along with the increased numberof sizes of the CUs. The system can perform the mode selection 905 toselect the optimal coding mode for encoding the image block. Then, usingthe selected mode, the encoder 900 can perform entropy coding 906, whichcan generate the output data 909.

Additionally, the encoder 900 can perform a loop filtering 907, in orderto reduce or suppress the blocking artifacts, e.g. in the referenceframes. For example, in HEVC, the system can take advantage of a pair offilters, which includes a de-blocking filter (DBF) and a sample adaptiveoffset filter (SAO). After removing the blocking artifacts, the outputfrom the in-loop filter can be stored in the reference frame and context908 and can be used in the encoding of the next blocks, e.g. for motionestimation 903.

As illustrated in FIG. 9, a coding rate control module 910 may beresponsible for bit allocation 911, coding information analysis andmodel update 912, and coding parameter prediction 913. For example, inH.264, the implementation of the macroblock rate control scheme cancomprise several processes: macroblock target bit pre-allocation,macroblock group target bit adjustment, macroblock group coding QPprediction, entropy coding information (statistics) collection andmacroblock model parameter updates.

FIG. 10 illustrates rate control for different control groups at basicunit level, in accordance with various embodiments of the presentdisclosure. As illustrated, a video encoder 1000 can be used forencoding a video stream 1002 into encoded data 1004. The input videostream 1002 may include a plurality of images frames, such as imagesframes A-C. Each image frame A-C can be partitioned into differentcoding block groups, such as different control groups of basic units(e.g. control groups a-c).

As shown in FIG. 10, each control group a-c may be associated with aseparate control model. Additionally, corresponding control groups ofbasic units in different image frames may share the same control model.For example, the control group a 1011 in each of the image frames A-Cmay be associated with a control model 1021 with one or more modelparameters 1031; the control group b 1012 in each of the image framesA-C may be associated with a control model 1022 with one or more modelparameters 1032; and the control group c 1013 in each of the imageframes A-C may be associated with a control model 1031 with one or moremodel parameters 1033.

In accordance with various embodiments, the granularity of rate controlat the basic unit level depends on the selection of the coding blockgroups (or control groups). For example, in H.264, a basic unit forcoding may be a macroblock, and a control group of basic units may bechosen as a group of macroblocks, such as a slice, a tile, or a row ofmacroblocks. Alternatively, in HEVC, a basic unit can be a coding treeunit (CTU), and a control group of basic units may be chosen as a groupof CTUs. In HEVC, a CTU, also referred to as a largest coding unit(LCU), may be further divided into one or more coding tree blocks (CTBs)and coding units (CUs).

In accordance with various embodiments of the present disclosure,various methods can be employed for rate control at the basic unitlevel. For example, a rate control scheme in the reference software forthe HEVC standard can be implemented based on the largest coding unit(LCU). The bit allocation step can be performed for calculating theweight based on an R-λ control model for each LCU (e.g., in the size of64×64 pixels). Then, the system can adjust the bit allocation based onthe outcome (or error) of coded LCU and calculate the QP for the nextLCU. However, overhead, such as the hardware storage and computationaloverhead, for the R-λ, based rate control scheme can be significant dueto the fine control granularity. Also, the R-λ, based rate controlscheme may require complex algorithms to deal with the intensiveprocessing and the frequent outliers. Furthermore, the LCU level may notbe easily achieved due to the existence of pipeline delay in feedingback coding statistics.

In accordance with various embodiments of the present disclosure, a ratecontrol scheme based on a logarithmic R-QP model can achieve precisecontrol of the video coding with efficiency. Even when the sourcecontent changes drastically, the bit rate control algorithm can achievethe efficient use of channel bandwidth, while reducing the frame-leveldelay during the transmission process.

FIG. 11 illustrates an exemplary rate control scheme 1100 at basic unitlevel, in accordance with various embodiments of the present disclosure.As illustrated, at the step 1101, an encoder 1100 can perform initialbit allocation for each control group of the basic units. For example,in H.264, the control group can be a macroblock group (e.g. a row ofmacroblocks). Prior to the coding of each image frame, the encoder 1100can perform initial bit allocation for each macroblock group in theimage frame according to the corresponding control model associated witheach macroblock group.

In various embodiments, the initial bit allocation can be performed atframe level based on the frame rate control model and the target bitrate for the frame to be encoded. The encoder 1100 can determine codingparameters (e.g. QPs) at frame level for the frame to be coded. Then,the encoder 1100 can use the predicted frame level coding QP, with thecorresponding control model for each macroblock group, to predict thecoding rate such as the coding bits per pixel (bpp) for each macroblockgroup. Furthermore, the target coded bits of the encoded frame may bepre-allocated for each macroblock group based on the predicted bit rateof each macroblock, which may be used as an indicator for the complexityin each macroblock.

For example, the bit allocation for each macroblock row can be performedusing the following formula,

$T_{i} = {{Target\_ bits} \cdot \frac{{bpp}_{i}}{\sum_{i = 1}^{N}{bpp}_{i}}}$

where N is the number of macroblocks in the image frame, T_(i) is thenumber of target bits pre-allocated for the i-th macroblock row, andTarget_bits represent the target coded bits for the entire frame.

At the step 1102, the encoder 1100 can obtain a control group of basicunits, such as a row of macroblocks in a buffer, and determine whetherthe bit allocation for the control group needs to be adjusted. Forexample, at the step 1103, the encoder 1100 can determine whether theobtained control group is the first control group for coding in an imageframe. If the acquired group is the first group, the system can proceedto encode the group. At the step 1104, if the obtained control group isnot the first group in an image frame (i.e. a portion of the targetcoded bits for the image frame has been coded or consumed), the encoder1100 can adjust the bit allocation for the obtained group based on thecoding result of the one or more earlier groups.

In various embodiments, after encoding a macroblock row, the encoder1100 can determine a deviation between the number of bits actuallyconsumed for encoding the macroblocks in the image frame and the numberof the pre-allocated target number of bits. It is beneficial to make acompensation or adjustment to the number of pre-allocated bits for thenext macroblock row to be encoded according to the deviation. In variousembodiments, a sliding window can be used for avoiding codingfluctuation. For example, the adjustment can be calculated as follows,

$R_{i} = {T_{i} + \frac{{Acc\_ delta}{\_ bits}}{SW}}$

where SW is the window size, R_(i) is the number of target bits withcompensation for the i-th macroblock row, T_(i) is the number of targetbits pre-allocated for the i-th macroblock row. Additionally,Acc_delta_bits is the cumulative coding error for the coded i−1macroblock rows of the current frame (i.e. the difference between thenumber of pre-allocated target bits and the actual number of bitsconsumed).

At the step 1105, the encoder 1100 can calculate quantization parameter(QP) for the control group based on the adjusted target bit using therate control model. For example, the system can calculate the predictedQP_(i) for the i-th macroblock row based on the target bpp_(i), which iscalculated according to the adjusted bit rate, R_(i). In variousembodiments, the coding QPs for the adjacent macroblocks may not varydrastically to ensure satisfactory visual quality. For example, it maybe beneficial to apply the following constraint on the QP_(i) accordingto the QP_(i−1) for the adjacent macroblock row.

QP_(i−1)−1≤QP_(i)≤QP_(i−1)+1

In various embodiments, the encoder 1100 can further adjust the targetbit rates pre-allocated to each control group based on the complexity.The encoder 1100 can make coding parameters adjustment according to thepre-allocated bit rate to determine whether an image block is a flatarea or a complex area, in order to adjust the coding parameters toimprove the coding efficiency and quality. For example, in the case oflow bit rate, the system can adjust the coding parameters in order tofocus on the most sensitive areas in an image frame. In variousembodiments, the system can determine that a macroblock groupcorresponds to a flat area with less texture, when the pre-allocated bitrates is less than a threshold. Also, the encoder 1100 can determinethat a macroblock group corresponds to a complex area with more texture,when the pre-allocated bit rates is higher than the same or a differentthreshold. These thresholds may be determined according to the averagebit rate, e.g. a ratio to the average bit rate. Then, the QP for codinga particular macroblock group can be adjusted, e.g. by adding orsubtracting a predetermined value, ΔQP. Additionally, in order toincrease the visual quality of the coded image, the flat areas in animage frame may be categorized into multiple levels, distinguished bydifferent thresholds and coded with different QPs. Similarly, thecomplex areas in an image frame may also be categorized into multiplelevels, distinguished by different thresholds and encoded usingdifferent QPs. Thus, the system can ensure the fluency in datatransmission, especially in various low coding rate scenarios, byreducing the resource allocated to visually insensitive areas.

Additionally, the bit rate control model for each macroblock group canbe updated iteratively on a frame-by-frame basis. Due to the differencein the number of bits for coding different types of frames (such as theI and P frames), the system may apply macroblock group rate control andmodel update only on the same type of coding frames. For example, forthe Low-Delay P frame structure (IPPPPPP . . . ) or the Period-I (IPPPIPPP . . . ) frame structure, the model update may be performed on the Pframe only. For the I-frames, the rate control model is not updated(even though the rate control model may be used to predict QP for theI-frames).

At the step 1106, the encoder 1100 can encode the obtained control groupof basic units using the calculated QP. Furthermore, at the step 1107,the encoder 1100 can update the rate control model parameters for themacroblock group, e.g. based on the coding information and/or theentropy coding statistics. Referring back to FIG. 10, the encoding ofthe frame C can be based on the historic coding information 1030 fromthe image frames A and B. For example, in H.264, the system can beresponsible for counting the number of bits consumed after the coding ofeach macroblock (group) and obtaining the error statistics after thelast macroblock of each row is coded. Thus, the model parameters of themacroblock row may be updated based on the QP used for encoding themacroblock row in the image frame and the error statistics collectedfrom analyzing the outcome of the encoding process. Then, the updatedmodel can be used as the bit rate control model for the control group atthe same location in the next frame, e.g. participating at least in thebit pre-allocation and QP prediction process for the next frame.

At the step 1108, the encoder 1100 can determine whether a particularimage frame is completed. If not, the system can obtain another controlgroup for coding until it finishes coding the image frame. Thus, usingthe above rate control scheme, the system can achieve accurate videocoding rate control. An input image frame can be encoded in one passwith coding rate matching substantially with the target bit rate. Also,the system can make full use of channel bandwidth and reduce thetransmission delay. In the process of encoding each image frame, thesystem can adjust the coding parameters for each control group of basicunits, such as for each macroblock group. Thus, the system can make theappropriate adjustment to ensure a smooth code rate, even when thesource of content changes drastically.

In accordance with various embodiments of the present disclosure, ratecontrol at the basic unit level may be implemented using hardwareimplementation to achieve efficiency. Hardware implementation may needto consider various types of overheads. For example, the selection ofthe control group can be determined according to the control precisionrequirements and implementation cost.

FIG. 12 illustrates an exemplary hardware implementation of the ratecontrol scheme, in accordance with various embodiments of the presentdisclosure. As shown in FIG. 12, a hardware implementation of the system1200 may process multiple coding block groups such as control groups ofbasic units, e.g. twelve (12) macroblock rows, in a sequential fashion(i.e. using a pipeline).

The system 1200 may start processing the first macroblock row in theimage frame using a first QP value, QP0. As soon as the system finishesprocessing the first macroblock row, the system 1200 may start processthe second macroblock row without delay. Due to the time required foranalyzing the coding statistics for the first macroblock row, theupdated coding parameter, e.g. QP1, may not be available immediately. Inorder to avoid interrupting the coding process, the system 1200 candelay the update of the coding parameter, QP1, while continuinglyprocessing the second macroblock row using the old coding parameter,QP0. As a result, the updating of the coding parameter may not occur atthe beginning of the processing of the second macroblock row (i.e. withan offset).

In various embodiments, the offset can be predetermined based on thetime required by the hardware implementation for analyzing the codingstatistics of a macroblock row. In the example as shown in FIG. 12, theoffset can be set to six (6), which indicates that the updated QP1, maybe applied to the second macroblock row except for the first sixmacroblocks, while QP0 can be used for encoding the first sixmacroblocks in the second macroblock row. As the encoding progresses,QP1 can be used for encoding the first six macroblocks in the thirdmacroblock row, and an updated QP2, may be applied to the thirdmacroblock row except for the first six macroblocks. In a similarfashion, the hardware implementation may be able to apply an updatedcoding parameter, e.g. QP_(i), to process each following macroblock row(e.g., the i-th row) in the image frame with an initial offset. In theexample as shown in FIG. 12, an old QP, e.g. QP_(i−1), can be used forencoding the first six macroblocks in each following macroblock row.

FIG. 13 illustrates a flow chat for controlling video encoding withinimage frame, in accordance with various embodiments of the presentdisclosure. As shown in FIG. 13, at step 1301, a video encoder canobtain an image frame, wherein the image frame comprises a plurality ofcoding block groups, wherein each coding block group includes one ormore coding blocks and each coding block group is associated with acoding control model. Furthermore, at step 1302, the video encoder candetermine values of one or more coding parameters, for a first codingcontrol model associated with a first coding block group, based on a bitallocation for the first coding block group. Then, at step 1303, thevideo encoder can use the first coding control model with the one ormore determined coding parameters to encode the first coding block group

Many features of the present disclosure can be performed in, using, orwith the assistance of hardware, software, firmware, or combinationsthereof. Consequently, features of the present disclosure may beimplemented using a processing system (e.g., including one or moreprocessors). Exemplary processors can include, without limitation, oneor more general purpose microprocessors (for example, single ormulti-core processors), application-specific integrated circuits,application-specific instruction-set processors, graphics processingunits, physics processing units, digital signal processing units,coprocessors, network processing units, audio processing units,encryption processing units, and the like.

Features of the present disclosure can be implemented in, using, or withthe assistance of a computer program product which is a storage medium(media) or computer readable medium (media) having instructions storedthereon/in which can be used to program a processing system to performany of the features presented herein. The storage medium can include,but is not limited to, any type of disk including floppy disks, opticaldiscs, DVD, CD-ROMs, microdrive, and magneto-optical disks, ROMs, RAMs,EPROMs, EEPROMs, DRAMs, VRAMs, flash memory devices, magnetic or opticalcards, nanosystems (including molecular memory ICs), or any type ofmedia or device suitable for storing instructions and/or data.

Stored on any one of the machine readable medium (media), features ofthe present disclosure can be incorporated in software and/or firmwarefor controlling the hardware of a processing system, and for enabling aprocessing system to interact with other mechanism utilizing the resultsof the present disclosure. Such software or firmware may include, but isnot limited to, application code, device drivers, operating systems andexecution environments/containers.

Features of the disclosure may also be implemented in hardware using,for example, hardware components such as application specific integratedcircuits (ASICs) and field-programmable gate array (FPGA) devices.Implementation of the hardware state machine so as to perform thefunctions described herein will be apparent to persons skilled in therelevant art.

Additionally, the present disclosure may be conveniently implementedusing one or more conventional general purpose or specialized digitalcomputer, computing device, machine, or microprocessor, including one ormore processors, memory and/or computer readable storage mediaprogrammed according to the teachings of the present disclosure.Appropriate software coding can readily be prepared by skilledprogrammers based on the teachings of the present disclosure, as will beapparent to those skilled in the software art.

While various embodiments of the present disclosure have been describedabove, it should be understood that they have been presented by way ofexample, and not limitation. It will be apparent to persons skilled inthe relevant art that various changes in form and detail can be madetherein without departing from the spirit and scope of the disclosure.

The present disclosure has been described above with the aid offunctional building blocks illustrating the performance of specifiedfunctions and relationships thereof. The boundaries of these functionalbuilding blocks have often been arbitrarily defined herein for theconvenience of the description. Alternate boundaries can be defined solong as the specified functions and relationships thereof areappropriately performed. Any such alternate boundaries are thus withinthe scope and spirit of the disclosure.

The foregoing description of the present disclosure has been providedfor the purposes of illustration and description. It is not intended tobe exhaustive or to limit the disclosure to the precise forms disclosed.The breadth and scope of the present disclosure should not be limited byany of the above-described exemplary embodiments. Many modifications andvariations will be apparent to the practitioner skilled in the art. Themodifications and variations include any relevant combination of thedisclosed features. The embodiments were chosen and described in orderto best explain the principles of the disclosure and its practicalapplication, thereby enabling others skilled in the art to understandthe disclosure for various embodiments and with various modificationsthat are suited to the particular use contemplated. It is intended thatthe scope of the invention be defined by the following claims and theirequivalence.

What is claimed is:
 1. A method for controlling video coding comprising:obtaining an image frame from a video stream, wherein the image frame isassociated with a coding control model; encoding the image frame using aquantization parameter (QP) calculated based on the coding controlmodel; determining whether a scene has changed significantly based on ananalysis of the encoded image frame; in response to the scene havingchanged significantly, initializing parameters for the coding controlmodel; and in response to no significant scene change, updating theparameters for the coding control model.
 2. The method of claim 1,further comprising, after obtaining the image frame from the videostream: determining whether the image frame is a first image frame ofthe video stream; and in response to the image frame being the firstimage frame, initializing the parameters for the coding control model.3. The method of claim 1, further comprising, after obtaining the imageframe from the video stream: obtaining a target bit rate for the imageframe; and calculating a bits-per-pixel (bpp) rate based on the targetbit rate for the image frame.
 4. The method of claim 1, wherein: thecoding control model includes a logarithm rate-quantization model or aquadratic rate-quantization model.
 5. The method of claim 4, wherein: inthe logarithm rate-quantization model, a logarithm function of a targetbit rate for the image frame is a linear function of the QP; andinitializing the parameters for the rate control model includesinitializing parameters of the linear function.
 6. The method of claim5, wherein: updating the parameters for the rate control model includesupdating the parameters of the linear function.
 7. The method of claim5, wherein: updating the parameters for the rate control model includesupdating the parameters of the linear function through a learning ratebased on a random gradient decent algorithm.
 8. The method of claim 7,wherein: the learning rate is pre-configured.
 9. The method of claim 7,wherein: the learning rate is determined dynamically.
 10. A videoencoder comprising: a memory storing one or more computer-executableinstructions; and one or more processors configured to access the memoryand execute the one or more computer-executable instructions to: obtainan image frame from a video stream, wherein the image frame isassociated with a coding control model; encode the image frame using aquantization parameter (QP) calculated based on the coding controlmodel; determine whether a scene has changed significantly based on ananalysis of the encoded image frame; in response to the scene havingchanged significantly, initialize parameters for the coding controlmodel; and in response to no significant scene change, update theparameters for the coding control model.
 11. The video encoder of claim10, after obtaining the image frame from the video stream, the one ormore processors are further configured to access the memory and executethe one or more computer-executable instructions to: determine whetherthe image frame is a first image frame of the video stream; and inresponse to the image frame being the first image frame, initialize theparameters for the coding control model.
 12. The video encoder of claim10, after obtaining the image frame from the video stream, the one ormore processors are further configured to execute the one or morecomputer-executable instructions to: obtain a target bit rate for theimage frame; and calculate a bits-per-pixel (bpp) rate based on thetarget bit rate for the image frame.
 13. The video encoder of claim 10,wherein: the coding control model includes a logarithm rate-quantizationmodel or a quadratic rate-quantization model.
 14. The video encoder ofclaim 13, wherein: in the logarithm rate-quantization model, a logarithmfunction of a target bit rate for the image frame is a linear functionof the QP; and initializing the parameters for the rate control modelincludes initializing parameters of the linear function.
 15. The videoencoder of claim 14, wherein: updating the parameters for the ratecontrol model includes updating the parameters of the linear function.16. The video encoder of claim 14, wherein: updating the parameters forthe rate control model includes updating the parameters of the linearfunction through a learning rate based on a random gradient decentalgorithm.
 17. The video encoder of claim 16, wherein: the learning rateis pre-configured.
 18. The video encoder of claim 16, wherein: thelearning rate is determined dynamically.
 19. One or more non-transitorycomputer-readable storage media storing computer-executable instructionsthat, when executed by a computing system, configure the computingsystem to perform operations comprising: obtaining an image frame from avideo stream, wherein the image frame is associated with a codingcontrol model; encoding the image frame using a quantization parameter(QP) calculated based on the coding control model; determining whether ascene has changed significantly based on an analysis of the encodedimage frame; in response to the scene having changed significantly,initializing parameters for the coding control model; and in response tono significant scene change, updating the parameters for the codingcontrol model.
 20. The computer-readable storage media of claim 19,wherein the instructions further configure the computing system toperform, after obtaining the image frame from the video stream:determining whether the image frame is a first image frame of the videostream; and in response to the image frame being the first image frame,initializing the parameters for the coding control model.